{include file='common/header' /}

<div class="second_banner"></div>
<div class="main-layout">
    <div id="container">
        <div class="col-main column">
            <div class=col-content>
                <h2 class=col-main-h2>留言列表</h2>
                <div class=col-main-cnt>
                    <div class="qa">
                        <ul>
                            {foreach name='lists' item='vo'}
                            <li>
                                <div class="q">
                                    <label>问：</label><span>{$vo.content}</span>
                                    <div class="clear"></div>
                                </div>
                            {notempty name='vo.reply'}
                                <div class="a">
                                    <label>答：</label><span>{$vo.reply}</span>
                                    <div class="clear"></div>
                                </div>
                            {/notempty}
                            </li>
                            {/foreach}
                        </ul>
                    </div>
                {$page}
                </div>
            </div>

            <style>
                .guestbook-form {
                    width: 80%;
                    margin: 10px auto;
                }
                .guestbook-form input,textarea {
                    width: 90%;
                    border: 1px solid #ccc;
                    padding: 10px;
                    border-radius: 5px;
                }
                .guestbook-form button {
                    border: 1px solid #ccc;
                    border-radius: 5px;
                    margin: 10px 0;
                    padding: 10px 20px;
                    background: none;
                }
            </style>
            <form class="guestbook-form" method="post" onsubmit="return EBCMS.AUTH.guestbook();" action="{:url('index/guestbook/index')}">
                <div class="form-group">
                    <label for="inputnickname3" class="col-sm-2 control-label">昵称</label>
                    <div class="col-sm-10">
                        <input name="nickname" type="text" class="form-control" id="inputnickname3">
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputcontent3" class="col-sm-2 control-label">内容</label>
                    <div class="col-sm-10">
                        <textarea name="content" id="inputcontent3" class="form-control" rows="6"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputmobile3" class="col-sm-2 control-label">电话</label>
                    <div class="col-sm-10">
                        <input type="text" name="mobile" class="form-control" id="inputmobile3">
                    </div>
                </div>
                {if condition="ebconfig('guestbook.verify')"}
                    {include file='common/verify' /}
                {/if}
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-default">提交</button>
                    </div>
                </div>
            </form>

            <script>
                Namespace.register("EBCMS.AUTH");
                $(function(){
                    EBCMS.AUTH.guestbook = function(){
                        $.ajax({
                            url: '{:url('index/guestbook/index')}',
                            type: 'POST',
                            dataType: 'json',
                            data: $('#guestbook').serialize(),
                            success:function(data){
                                if (data.code) {
                                    alert(data.msg);
                                    self.location=data.url;
                                }else{
                                    alert(data.msg);
                                    EBCMS.FN.change_verify('#verify_img');
                                }
                            }
                        });
                        return false;
                    };
                });
            </script>
        </div>
        <div class="col-sub column" style="min-height: 600px;">
            <div class="newl">
                <ul>
                    <li class="main">
                        <a href="/contact">联系方式</a>
                    </li>
                    <li class="main">
                        <a href="/recruit">招贤纳士</a>
                    </li>
                    <li>
                        <a href="/guestbook">在线留言</a>
                    </li>
                </ul>
                <div class="btmbor"></div>
            </div>
        </div>
    </div>
</div>
{include file='common/footer' /}